<%@page import="wt.httpgw.URLFactory"%>
<%@page import="shmged.com.shlcm.portal.CmMenuConfigItem" %>
<%@page import="shmged.com.shlcm.portal.CmMenuDisplayConfig" %>
<%@page import="java.util.List" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%String baseUrl = new URLFactory().getBaseHREF(); %>
<%CmMenuDisplayConfig mdc = new CmMenuDisplayConfig();
  //List<MenuConfigItem> mcilist= mdc.readExcel();
  String menus = mdc.getDisplayable();
%>
<script type="text/javascript" src="javascript/util/jquery-easyui-1.3.3/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	generateMenu();
	function generateMenu() {
		var menus = "<%=menus%>";
		menus = menus.replace("[","");
		menus = menus.replace("]","");
		var menulist = menus.split(", ");
		var tempLen = menulist.length;
		var level = -1;
		for(var i=0;i<menulist.length;i++){
			if(menulist[i].indexOf("_") == -1) {
				$("#cmAccordion").append("<div title=" + menulist[i] + 
						" data-options="+"iconCls:'tree-folder-open'" +
						" style="+"overflow:auto;padding:10px;" +
						"></div>");
				$("div[title="+ menulist[i] +"]").append("<center>");
				level = level+1;
			} else {
				if(i+1 < tempLen) {
					if(menulist[i+1].indexOf("_") != -1) {
						$("div[title=" + menulist[i].substring(0,menulist[i].indexOf("_"))+ "]>center").append("<a href="+"javascript:void(0)"+
								" onclick="+"cmOnclickSelected(this," + level + ")"+">"+ 
								menulist[i].substring(menulist[i].indexOf("_")+1, menulist[i].length) +"</a><hr/>");
					} else {
						$("div[title=" + menulist[i].substring(0,menulist[i].indexOf("_"))+ "]>center").append("<a href="+"javascript:void(0)"+
								" onclick="+"cmOnclickSelected(this," + level + ")"+">"+ 
								menulist[i].substring(menulist[i].indexOf("_")+1, menulist[i].length) +"</a>");
					}
			 	} else {
				 	$("div[title=" + menulist[i].substring(0,menulist[i].indexOf("_"))+ "]>center").append("<a href="+"javascript:void(0)"+
							" onclick="+"cmOnclickSelected(this," + level + ")"+">"+ 
							menulist[i].substring(menulist[i].indexOf("_")+1, menulist[i].length) +"</a>");
				}
			}
		}
	}
</script>

